@extends('admin.app')

@section('breadcrumb')
<div class="bg-light lter b-b wrapper-md">
  <ol class="breadcrumb bg-light lter m-n no-padder">
    <li><a href="{{ admin_action('HomeController@index') }}">主页</a></li>
    <li>Rbac</li>
    <li><a href="{{ admin_action('Rbac\PermissionsController@index') }}">权限管理</a></li>
    <li class="active">编辑权限</li>
  </ol>
</div>
@endsection

@section('content')
  <div class="panel panel-default">
    <div class="panel-heading font-bold">
      编辑权限表单
    </div>
    <div class="panel-body">
      <form class="form-horizontal form-validation" action="{{ admin_action('Rbac\PermissionsController@update', [$permission]) }}" method="post">
        {{ csrf_field() }}
        {{ method_field('PUT') }}
        <div class="form-group">
          <label class="col-lg-2 control-label">名称*</label>
          <div class="col-lg-10">
            <input type="text" class="form-control" name="name" value="{{ $permission->name }}" placeholder="请输入名称" data-rule-required="true" data-rule-maxlength="50"> 
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">请求方法</label>
          <div class="col-lg-10">
            <input type="text" class="form-control" name="methods" value="{{ $permission->methods }}" placeholder="请输入请求方法" data-rule-maxlength="50">
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">请求链接</label>
          <div class="col-lg-10">
            <input type="text" class="form-control" name="uri" value="{{ $permission->uri }}" placeholder="请输入请求链接"data-rule-maxlength="200">
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">父级权限</label>
          <div class="col-lg-10">
            <select class="form-control" name="pid">
              <option value="0">无</option>
              @foreach ($parents as $parent)
              <option value="{{ $parent->id }}" {{ $parent->id == $permission->pid ? 'selected' : '' }}>{{ str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $parent->level).$parent->name }}</option>
              @endforeach
            </select>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">描述</label>
          <div class="col-lg-10">
            <textarea class="form-control" rows="4" name="description" placeholder="请输入描述" data-rule-maxlength="100">{{ $permission->description }}</textarea>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">菜单</label>
          <div class="col-lg-10">
            <label class="checkbox-inline i-checks"><input type="radio" name="is_menu" value="1" {{ $permission->is_menu==1?'checked':'' }}/><i></i>是</label>
            <label class="checkbox-inline i-checks"><input type="radio" name="is_menu" value="0" {{ $permission->is_menu!=1?'checked':'' }}/><i></i>否</label>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-lg-4 col-lg-offset-2">
            <a href="{{ admin_action('Rbac\PermissionsController@index') }}" class="btn btn-default">返&nbsp;回</a>
            <button type="submit" class="btn btn-primary">保&nbsp;存</button>
          </div>
        </div>
      </form>
    </div>
  </div>
@endsection